package adv2;

//牛鼻之计算器
public class Calc {
	public int add(int a, int b) {
		return a + b;
	}

	public int add(int a, int b, int c) {
		return a + b + c;
	}

	public int add(int[] ar) {
		return 0;
	}

	// n是数组,计算n个数的和
	// 可变参数求和
	public int jia(int... n) {
		int s = 0;
		for (int i = 0; i < n.length; i++)
			s += n[i];
		return s;
	}
	// 乘法：

	public static void main(String[] args) {
		Calc c = new Calc();
		int r1 = c.jia(10, 2);
		System.out.println(r1);
		r1 = c.jia(1, 3, 5, 7);
		System.out.println(r1 + "==16");
		r1 = c.jia(10);
		System.out.println("10 ????" + r1);
		int r2 = c.jia();
		System.out.println("0==? r2=" + r2);
	}
}
